package com.eastjet.maintenance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eastjet.maintenance.domain.StorageLocation;
import com.eastjet.maintenance.mapper.StorageLocationMapper;
import com.eastjet.maintenance.service.StorageLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨博文
 * @description 针对表【storage_location(存放位置)】的数据库操作Service实现
 * @createDate 2024-11-25 09:23:39
 */
@Service
public class StorageLocationServiceImpl extends ServiceImpl<StorageLocationMapper, StorageLocation> implements StorageLocationService {

    @Autowired
    private StorageLocationMapper storageLocationMapper;

    /**
     * 新增存放位置
     *
     * @param location
     * @return
     */
    @Override
    public Boolean InsetStorageLocation(StorageLocation location) {
        return this.save(location);
    }

    /**
     * 查询存放位置
     *
     * @return
     */
    @Override
    public List<StorageLocation> SelectLocation(String name) {
        return storageLocationMapper.selectAll(name);
    }

    /**
     * 删除存放位置
     *
     * @param code
     * @return
     */
    @Override
    public Boolean DeleteLocation(String code) {
        return storageLocationMapper.DeleteLocation(code) == 1 ? true : false;
    }

    /**
     * 更新存放位置
     *
     * @param location
     * @return
     */
    @Override
    public Boolean UpdateLocation(List<StorageLocation> location) {
        return this.updateBatchById(location);
    }

    /**
     * 更新存放位置状态
     *
     * @param code
     * @param status
     * @return
     */
    @Override
    public Boolean UpdateLocationQi(String code, String status) {
        return storageLocationMapper.UpdateLocation(code, status) == 1 ? true : false;
    }
}




